package com.woniu40.petai_manager.mapper;

import com.woniu40.petai_manager.entity.Dynamic;
import com.woniu40.petai_manager.vo.DynamicVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DynamicMapper {
    int deleteByPrimaryKey(Integer dynamicId);

    int insert(Dynamic record);

    Dynamic selectByPrimaryKey(Integer dynamicId);

    List<DynamicVo> selectAll(String name);

    int updateByPrimaryKey(Dynamic record);

    @Update("update t_dynamic set dynamic_priority=100 where dynamic_id =#{dynamicid}")
    int updatePriority(Integer dynamicid);

    @Update("update t_dynamic set dynamic_priority=1 where dynamic_priority =100")
    int dancelPriority();
    //删除动态
    @Delete("delete from t_dynamic where dynamic_id=#{value}")
    int deleteDyn(Integer dynamicId);
    //根据id获得被举报动态
    @Select("select * from t_dynamic where dynamic_id=#{value}")
    Dynamic selectByDynId(Integer dynamicId);


}